library(devtools)
devtools::load_all()


devtools::install()


use_package("htmlwidgets",type = "Suggests")



htmlwidgets::scaffoldWidget("mywidgetTest")
htmlwidgets::scaffoldWidget("lineTest")
htmlwidgets::scaffoldWidget("barChart")
htmlwidgets::scaffoldWidget("Sunburst")
htmlwidgets::scaffoldWidget("volcano")
htmlwidgets::scaffoldWidget("volcanoD3")


htmlwidgets::scaffoldWidget("peakD3")


# use_r("1_volcanoMain")
#
#
#
#
#
# mywidgetTest(100)
#
#
#
# a=  volcano("aa")
# a
# htmlwidgets::saveWidget(a,"volcamo.html")
#
#
#
#
#
#
#
#
#
#
# myData = data.frame(
#   "month" = c(1,2,3,100,5,11),
#   "apples" = c(2,2,3,4,5,11),
#   "bananas" = c(3,2,3,4,5,11),
#   "cherries" = c(4,2,3,4,5,11),
#   "dates" = c(4,2,3,4,5,11)
# )
# lineTest(myData)
#
#
#
#
# barChart("aaa")
#
#
#
#
#
# data = list(
#   "name" = "flare",
#   "children" = list(
#     "name" = "1","value" = 1
#   )
# )
#
# data = jsonlite::toJSON(data,auto_unbox=T)
#
# data = jsonlite::fromJSON("data-raw/xinjiang.json")
#
# devtools::load_all()
# Sunburst(data,height = 1000,width = 1600)
#
#
#
#
# df = read.delim("data-raw/旭日图.csv",sep=",")
# df
#
# # 1. 基本通 yes
# # 2. 参数通 yes
# # 3. 数据通 yes
# # 4. 图通




# demo --------------------------------------------------------------------
library(D3Widget)
?volcanoD3
df = read.delim("https://www.bioladder.cn/shiny/zyp/bioladder2/demoData/Volcano/Volcano.txt")[,1:3]
p  =volcanoD3(data=df,notsig="red",r=10,xangle="30",fc=10,pvalue=0.1,myWidth = 500,myHeight = 900)
p

htmlwidgets::saveWidget(p,"result.html")




# 谱图
devtools::load_all()
library(tidyverse)


df = readxl::read_excel("../msverse/temp.a.xlsx")
df


ggplotSvg = xml2::read_xml( "../msverse/p2.svg") %>%
  as.character()

p1 = peakD3(data = df,
            axisY = "absolute",
            titleY = "Intensity",
            height = 500,
            ifLabel = T,
            bColor = "red",
            showControls = F,
            ggplotSvg = ggplotSvg
            )

p1
htmlwidgets::saveWidget(p1,"peakD3.html")
